<?php
class PsychologistController extends CController {
	public function actionView() {
		$id = isset($_GET['id']) ? (int)$_GET['id'] : null;
		if($id !== null) {
			$psychologist = Psychologists::model()->findByPk($id);
		

			$this->renderPartial('view', array(
					'psychologist' => $psychologist
				)
			);
		}
	}

	public function actionQqList() {
		$psychologistQQs = PsychologistsMeta::model()->with('psychologist')->findAll('metaKey = "'.PsychologistsMeta::KEY_QQCODE.'" AND metaValue != ""');
		$this->renderPartial('qq_list', array('psychologistQQs' => $psychologistQQs));
	}
	
	public function actionList() {
		$categoryIds = array(33);
		$posts = array();
		foreach($categoryIds as $k => $v) {
			$posts[$k] = Posts::model()->findByCategoryId($v);
		}

		$criteria = new CDbCriteria;
		$psychologists = Psychologists::model()->findAll($criteria);

		$this->setPageTitle('咨询师介绍 - 广州心理咨询网');
		$this->render('list', array(
				'psychologists' => $psychologists,
				'posts' => $posts
			)
		);
	}
}